import React from "react";
import { Form, Input } from "antd";
import styles from "./BasicInfo.less";

const BasicInfo = (props) => {
  const {
    form: { getFieldDecorator },
    formData: {
      userCode,
      userName,
      userPartType,
      orgName,
      userSex,
      // userType,
      // userPoliceId,
    } = {},
  } = props;
  const formLayout = {
    labelCol: {
      xs: { span: 24 },
      sm: { span: 8 },
    },
    wrapperCol: {
      xs: { span: 24 },
      sm: { span: 16 },
    },
  };
  let sex = '';
  if (userSex === "1") {
    sex = '男';
  } else if (userSex === "2") {
    sex = '女';
  }
  return (
    <div className={styles.root}>
      <div className={styles.title}>基本信息</div>
      <div className={styles.info}>
        <Form {...formLayout}>
          <Form.Item label="账号">
            {getFieldDecorator("userCode", {
              rules: [{ required: true }],
              initialValue: userCode,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item>
          <Form.Item label="姓名">
            {getFieldDecorator("displayName", {
              rules: [{ required: true }],
              initialValue: userName,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item>
          <Form.Item label="性别">
            {getFieldDecorator("userSex", {
              rules: [{ required: true }],
              initialValue: sex,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item>
          {/* <Form.Item label="警号">
            {getFieldDecorator("userPoliceId", {
              rules: [{ required: true }],
              initialValue: userPoliceId,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item> */}
          {/* <Form.Item label="身份类型">
            {getFieldDecorator("userType", {
              rules: [{ required: true }],
              initialValue: userType,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item> */}
          <Form.Item label="岗位">
            {getFieldDecorator("userPartType", {
              rules: [{ required: true }],
              initialValue: userPartType,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item>
          <Form.Item label="所属机构">
            {getFieldDecorator("orgName", {
              rules: [{ required: true }],
              initialValue: orgName,
            })(<Input style={{ width: 466, marginLeft: 8 }} disabled />)}
          </Form.Item>
        </Form>
      </div>
    </div>
  );
};

const BasicInfoForm = Form.create()(BasicInfo);

export default BasicInfoForm;
